package cn.tedu.boot011.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BmiController {
    @RequestMapping("/bmi")
    @ResponseBody
    public String bmi(double h, double w){
        double bmi = w/(h*h);
        String res;
        if (h<=0 || w<=0){
            res = "请输入正确的信息";
        }else if(bmi <18.5){
            res = "偏瘦";
        }else if(bmi <24){
            res = "正常";
        }else if (bmi <28){
            res = "微胖";
        }else {
            res = "有点胖了";
        }
        return bmi +":"+ res;
    }
}
